package com.ruoyi.web.controller.system.api.app;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.framework.interceptor.Authentication;
import com.ruoyi.system.api.ResponseWithData;
import com.ruoyi.system.api.domain.ServiceNotice;
import com.ruoyi.system.api.service.IServiceNoticeService;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * CC调用接口 服务通知
 *
 * @ClassName ServiceNoticeCcController.java
 * @date 2020/4/3 1:43 下午
 * @author yzg
 */
@Api(tags="CC调用接口 服务通知")
@Controller
@RequestMapping("/api/app/service/notice")
public class ServiceNoticeCcController extends BaseController {

    @Autowired
    private IServiceNoticeService iServiceNoticeService;

    private static final Logger log = LoggerFactory.getLogger(ServiceNoticeCcController.class);
    /**
     *  CC调用接口 关闭服务通知
     *
     * @param serviceNo	服务派单号
     * @param closePersonId	关闭服务通知人员ID
     * @return com.ruoyi.system.api.ResponseWithData
     * @author yzg
     * @date 2020/4/3 2:10 下午
     */
    @GetMapping("closeServiceNotice")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "关闭服务通知", httpMethod = "GET", notes = "关闭服务通知")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "服务派单号", name = "serviceNo", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(value = "关闭服务通知人员ID", name = "closePersonId", required = true, dataType = "String", paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功" )
    })
    public ResponseWithData closeServiceNotice(@RequestParam("serviceNo") String serviceNo, @RequestParam("closePersonId") String closePersonId) {
        try {
            return iServiceNoticeService.closeServiceNotice(serviceNo, closePersonId);
        } catch (Exception e) {
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

}
